<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head th:replace="head :: commonHead(${status eq 1 ? '待评价' : '已评价'})">

</head>

<body>

<div th:replace="head :: header"></div>

<div id="app" class="user_container clearfix">

    <div th:replace="content/personal/left :: body"></div>

    <!-- 右侧内容 -->
    <div class="right_boxwrap">
        <div class="user_right_box">
            <div class="user_right_box_title">
                <div class="user_right_box_title_l">
                    <em></em>
                    <h3 th:text="${status eq 1 ? '待评价' : '已评价'}"></h3>
                </div>
            </div>

            <div class="goods_content">
                <div class="goods_con_title clearfix">
                    <div class="goods_con_title_left">
                        <a th:href="@{'/evaluate/list/' + ${status} + '?method=1'}" th:class="${method eq 1 ? 'btn on' : 'btn'}">拍同款</a>
                        <a th:href="@{'/evaluate/list/' + ${status} + '?method=2'}" th:class="${method eq 2 ? 'btn on' : 'btn'}">私人定制</a>
                    </div>
                    <div class="goods_con_title_right">
                        <input type="text" id="search-word" placeholder="订单号/摄影师名称/作品名称"/>
                        <a href="javascript:void(0)" id="search"><i class="iconfont icon-fangdajing"></i></a>
                    </div>
                </div>

                <div class="goods_nav">
                    <ul class="clearfix">
                        <li><span
                                th:text="${range eq 1 ? '近7天订单' : (range eq 2 ? '近三个月订单' : (range eq 3 ? '近半年订单' : '全部'))}"></span>
                            <i class="iconfont icon-iconfontarrows1"></i>
                            <ul class="find_nav">
                                <li><a th:href="@{'/evaluate/list/' + ${status} + '?method=' + ${method} + '&range=1'}">近7天订单</a>
                                </li>
                                <li><a th:href="@{'/evaluate/list/' + ${status} + '?method=' + ${method} + '&range=2'}">近三个月订单</a>
                                </li>
                                <li><a th:href="@{'/evaluate/list/' + ${status} + '?method=' + ${method} + '&range=3'}">近半年订单</a>
                                </li>
                            </ul>
                        </li>
                        <li>订单详情</li>
                        <li>金额</li>
                        <li>状态</li>
                        <li>操作</li>
                    </ul>
                </div>

                <!--/* 拍同款 */-->
                <div class="goods_con" th:if="${method eq 1}">
                    <div class="goods_con_box goods_con_box_tk" th:each="item:${page.list}">
                        <div class="goods_con_box_title clearfix">
                            <div class="time" style="margin-right: 30px;"
                                 th:text="${#dates.format(item.orderTime, 'yyyy-MM-dd HH:mm:ss')}"></div>
                            <div class="time">
                                订单号：[[${item.no}]]
                            </div>
                        </div>
                        <div class="goods_con_box_table clearfix">
                            <div class="left left_tk">
                                <h4>作品：[[${item.orderDetail.sameStyle.name}]]</h4>
                                <p class="p_tk">简介：[[${item.orderDetail.sameStyle.description}]]</p>
                            </div>
                            <div class="center" th:text="${'总金额：' + #numbers.formatDecimal(item.totalPrice,1,2)}"></div>
                            <div class="center_1" cus:dict="order-status,${item.status}"></div>
                            <div class="right">
                                <a th:if="${status eq 1 and item.statusStep eq 0 and item.orderDetail.photographer ne null and item.orderDetail.scriptwriter ne null}"
                                   th:href="@{'/evaluate/ready?targetType=3&target=' + ${item.id}}" target="_blank">去评价</a>
                                <a th:if="${status eq 2}" th:href="@{'/evaluate/detail/' + ${item.id}}" target="_blank">评价详情</a>
                                <a th:href="@{'/order/get/' + ${item.id}}" target="_blank">订单详情</a>
                            </div>
                        </div>
                    </div>
                    <div th:class="${page.list.size() == 0 ? 'goods_con_box' : 'goods_con_box hidden'}">
                        <div class="goods_con_box_null_tip">
                            暂时没有订单，快去选购喜爱的短视频吧！
                        </div>
                    </div>
                </div>

                <!--/* 私人定制 */-->
                <div class="goods_con" th:if="${method eq 2}">
                    <div class="goods_con_box" th:each="item:${page.list}">
                        <div class="goods_con_box_title clearfix">
                            <div class="time" style="margin-right: 30px;"
                                 th:text="${#dates.format(item.orderTime, 'yyyy-MM-dd HH:mm:ss')}"></div>
                            <div class="time">
                                订单号：[[${item.no}]]
                            </div>
                        </div>
                        <div class="goods_con_box_table clearfix">
                            <div class="left">
                                <div class="up">
                                    <h4>导演：[[${item.orderDetail.photoGrapherUser.name ne null ?
                                        item.orderDetail.photoGrapherUser.name :
                                        item.orderDetail.photoGrapherUser.nickname}]]</h4>
                                    <p class="p_dz">简介：[[${item.orderDetail.photoGrapherUser.description}]]</p>
                                </div>
                                <div class="down">
                                    <h4>编剧：[[${item.orderDetail.scriptWriterUser.name ne null ?
                                        item.orderDetail.scriptWriterUser.name :
                                        item.orderDetail.scriptWriterUser.nickname}]]</h4>
                                    <p class="p_dz">简介：[[${item.orderDetail.scriptWriterUser.description}]]</p>
                                </div>
                            </div>
                            <div class="center" th:text="${'总金额：' + #numbers.formatDecimal(item.totalPrice,1,2)}"></div>
                            <div class="center_1" cus:dict="order-status,${item.status}"></div>
                            <div class="right">
                                <a th:if="${status eq 1 and item.statusStep eq 0 and item.orderDetail.photographer ne null and item.orderDetail.scriptwriter ne null}"
                                   th:href="@{'/evaluate/ready?targetType=3&target=' + ${item.id}}" target="_blank">去评价</a>
                                <a th:if="${status eq 2}" th:href="@{'/evaluate/detail/' + ${item.id}}" target="_blank">评价详情</a>
                                <a th:href="@{'/order/get/' + ${item.id}}" target="_blank">订单详情</a>
                            </div>
                        </div>
                    </div>

                    <div th:class="${page.list.size() == 0 ? 'goods_con_box' : 'goods_con_box hidden'}">
                        <div class="goods_con_box_null_tip">
                            暂时没有订单，快去选购喜爱的短视频吧！
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:replace="foot :: body"></div>

</body>

<script type="text/javascript" charset="utf-8" th:src="${#request.getAttribute('ctx') + '/static/front/js/home.js'}"></script>

<script th:inline="javascript">
    $(function () {
        activeLeft('evaluate-list-' + [[${status}]]);

        // 加载码表
        OrderStatusDict.fresh('order-status');

        // 点击搜索
        $('#search').click(function () {
            var searchWord = $('#search-word').val();
            $.ajax({
                type: 'get',
                url: '/evaluate/api/list/' + [[${status}]],
                data: {
                    method: [[${method}]],
                    status: [[${status}]],
                    searchWord: searchWord
                },
                dataType: 'json',
                success: function (result) {
                    if (result.status == Messages.HTTP_STATUS.SUCCESS) {
                        if ($('.goods_con_box').length == 1) {
                            $('.goods_con_box').before('<div class="goods_con_box"></div>')
                        }

                        // 如果有数据, 开始渲染
                        if (result.data.page.list != null && result.data.page.list.length > 0) {
                            $('.goods_con_box:eq(0)').show();
                            // 隐藏tip
                            $('.goods_con_box:eq(1)').hide();
                            var html = '';
                            var data = result.data.page.list;
                            for (var i in data) {
                                var photographer = data[i].orderDetail.photographer;
                                var scriptwriter = data[i].orderDetail.scriptwriter;
                                var item = '<div class="goods_con_box goods_con_box_tk">\n' +
                                    '           <div class="goods_con_box_title clearfix">\n' +
                                    '               <div class="time" style="margin-right: 30px;">' + new Date(data[i].orderTime).Format('yyyy-MM-dd hh:mm:ss') + '</div>\n' +
                                    '               <div class="time">\n' +
                                    '                   订单号：' + data[i].no + '\n' +
                                    '               </div>\n' +
                                    '           </div>\n' +
                                    '           <div class="goods_con_box_table clearfix">\n' +
                                    '               <div class="left left_tk">\n' +
                                    '                   <h4>作品：' + data[i].orderDetail.sameStyle.name + '</h4>\n' +
                                    '                   <p class="p_tk">简介：' + data[i].orderDetail.sameStyle.description + '</p>\n' +
                                    '               </div>\n' +
                                    '               <div class="center">\n' +
                                    '                   总金额：' + new Number(data[i].totalPrice).Money() + '\n' +
                                    '               </div>\n' +
                                    '               <div class="center_1">' + OrderStatusDict.get(data[i].status, 'order-status') + '</div>\n' +
                                    '               <div class="right">\n' +
                                    '                   ' + ((data[i].status == 1 && data[i].statusStep == 0 && !!photographer && !!scriptwriter)
                                                            ? '<a href="/evaluate/ready?targetType=3&target=' + data[i].id + '" target="_blank">去评价</a>'
                                                            : (result.data.status == 2 ? '<a href="/evaluate/detail/' + data[i].id + '" target="_blank">评价详情</a>' : '')) +
                                    '                   <a href="/order/get/' + data[i].id + '" target="_blank">订单详情</a>\n' +
                                    '               </div>\n' +
                                    '           </div>\n' +
                                    '       </div>';
                                html += item;
                            }
                            $('.goods_con_box:eq(0)').html(html);
                        } else {
                            $('.goods_con_box_null_tip').text('未找到相关内容!');
                            $('.goods_con_box:eq(0)').hide();
                            $('.goods_con_box:eq(1)').show();
                        }
                    }
                }
            })
        })
    })
</script>

</html>
